import Vue from 'vue'
import Router from 'vue-router'

// 路由数据
import routes from './routes'

// 进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

window.publicPath = process.config.publicPath

Vue.use(Router)

const router = new Router({
  // mode:'history',
  base: window.publicPath,
  routes: routes
})

//拦截路由变化
window.firstTimeIntoSystem = true
router.beforeEach((to,from,next) =>{
  // 进度条
  NProgress.start()
  window.scroll(0,0)
  next()
})

router.afterEach(to => {
  // 进度条
  NProgress.done()
  // 需要的信息
  
})


export default router;

